home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 May & June
/
Amiga-CD 1996 #5-6.iso
/
demos
/
finaldata
/
fdmacros
/
restorelayout
< prev
next >
Wrap
Text File
|
1996-03-22
|
3KB
|
88 lines
/* ========================================================== */
/* Final Data ARexx Macro. */
/* RestoreLayout - Restore column positions and widths. */
/* $VER: RestoreLayout 1.0 (4.8.94) */
/* © 1994 SoftWood, Inc. */
/* Use of this macro is strictly at the user's risk. */
/* */
/* This macro is used in conjunction with the SaveLayout */
/* macro. Together they will allow you to save the current */
/* column layout (positions and widths) and then at a later */
/* time restore the column layout to what is was previously. */
/* To restore a previous layout, you must first have used the */
/* SaveLayout macro to create a layout file. Start the macro */
/* from Final Data. The column layout will be set to the data */
/* that is found in the layout file. */
/* ========================================================== */
OPTIONS RESULTS
/* ---------------------------------------------------------------- */
/* Turn off current selection. If we can't then exit with an error. */
/* ---------------------------------------------------------------- */
SelectOff
IF ( RC ~= 0 ) THEN DO
ShowMessage 1 1 '"Cannot continue." "Check cell for invalid data." "" "OK" "" ""'
EXIT 10
END
/* ----------------------------- */
/* Determine the layout filename */
/* and try to open it. */
/* ----------------------------- */
Filename COMPLETE
layoutFile = RESULT || ".FDLayout"
quotedFile = '"' || layoutFile || '"'
IF ( OPEN('thefile', layoutFile, 'Read') ) THEN DO
/* ----------------------------------------------- */
/* The layout file was opened. */
/* The layout file contains information for each */
/* column on each line. Each line has the columnid */
/* followed by the column width. The lines in the */
/* file are in the order that the columns are to */
/* appear in the database. */
/* ----------------------------------------------- */
cpos = 1
DO FOREVER
/* --------------------------- */
/* Read the next line of data. */
/* If the line is empty we are */
/* at the end of the file. */
/* --------------------------- */
dataline = READLN('thefile')
IF ( dataline = "" ) THEN LEAVE
err = 1
PARSE VAR dataline cid cwidth
InitModifyColumn cid
IF ( RC = 0 ) THEN DO
DefineColumn POSITION cpos WIDTH cWidth
IF ( RC = 0 ) THEN DO
ModifyColumn
IF ( RC = 0 ) THEN DO
cpos = cpos + 1
err = 0;
END
END
END
/* ------------------- */
/* Check if any errors */
/* ------------------- */
IF ( err ) THEN DO
ShowMessage 1 1 '"Error restoring columns." "" "" "OK" "" ""'
LEAVE
END
END /* Do forever */
CALL CLOSE('thefile')
END /* End OPEN */
ELSE DO
/* ------------------------------- */
/* layout file could not be opened */
/* ------------------------------- */
firstLine = '"Cannot open file."'
ShowMessage 1 1 firstLine quotedFile '"" "OK" "" ""'
EXIT 10
END